package com.example.design.chain.leaveapply.concrethandler;

import com.example.design.chain.leaveapply.handler.Leader;

/**
 * @Description 团队负责人-具体处理者（Concrete Handler）角色
 * @ClassName TeamLeader
 * @Author Administrator
 * @Date 2020/5/16 10:45
 * @Version 1.0.0
 */
public class TeamLeader extends Leader {
    public TeamLeader(String name) {
        super(name);
    }

    @Override
    public void handleRequest(int LeaveDays) {
        if(LeaveDays<=2) {
            System.out.println("团队经理 " + this.getName() + " 批准您请假" + LeaveDays + "天。");
        } else {
            if(getNext() != null) {
                getNext().handleRequest(LeaveDays);
            } else  {
                System.out.println("请假天数太多，没有人批准该假条！");
            }
        }
    }
}
